package meihua.stopcarapp.presenter;

import android.util.Log;

import meihua.mylibrary.baserx.RxSubscriber;
import meihua.stopcarapp.R;
import meihua.stopcarapp.bean.result.OrderEcodeResult;
import meihua.stopcarapp.presenter.contract.OrderEcodeContract;

/**
 * Name: LGZ
 * Time: 2017/5/19.
 * Dec:
 */

public class OrderEcodePresenter extends OrderEcodeContract.Presenter {
    @Override
    public void secdOrderEcodeRequest(String order_num, String order_monry, String coupon_id, String coupon_gid) {
        mRxManage.add(mModel.sendOrderEcode(order_num, order_monry,coupon_id,coupon_gid)
                .subscribe(new RxSubscriber<OrderEcodeResult>(mContext,false) {
                    @Override
                    public void onStart() {
                        super.onStart();
                        mView.showLoading(mContext.getString(R.string.loading));
                    }
                    @Override
                    protected void _onNext(OrderEcodeResult entity) {
                        Log.d("ligaozeng","请求成功");
                        mView.returnOrderEcode(entity);
                        mView.stopLoading();
                    }
                    @Override
                    protected void _onError(String message) {
                        Log.d("ligaozeng","服务器错误:"+message);
                    }
                }));
    }
}
